package com.micro.center.controller;

import com.micro.center.dto.AppDto;
import com.micro.center.entity.SysAppEntity;
import com.micro.center.service.SysAppService;
import com.micro.common.constant.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author pan.shun
 * @since 2022/7/12 17:29
 */
@RestController
@RequestMapping("/app")
public class AppController {

    @Autowired
    private SysAppService sysAppService;

    @GetMapping("/list")
    public R getList(AppDto appDto) {
        return sysAppService.getList(appDto);
    }

    @GetMapping("/delete/{appId}")
    public R delete(@PathVariable String appId) {
        return sysAppService.delete(appId);
    }

    @PostMapping("/addOrUpdate")
    public R addOrUpdate(@RequestBody SysAppEntity sysAppEntity) {
        return sysAppService.addOrUpdate(sysAppEntity);
    }

    @GetMapping("/getUrlByAppId/{appId}")
    public R getUrlByAppId(@PathVariable String appId) {
        return sysAppService.getUrlByAppId(appId);
    }
}
